#"...\server\server.py"
from CGIHTTPServer import CGIHTTPRequestHandler
from BaseHTTPServer import HTTPServer
import sys, os

server_address = ""
webdir = '.'

if sys.argv[3:]:
	webdir = sys.argv[1]
	server_address = (sys.argv[2], int(sys.argv[3]))
else:
	print "USAGE: server.py WEBDIR IP PORT"
	exit(1)

os.chdir(webdir)

print "Starting server on %s" % (str(server_address))
httpd = HTTPServer(server_address, CGIHTTPRequestHandler)

httpd.serve_forever()
#or for debugging:
#httpd.handle_request()